home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / kerberos / pc / krb_libd.lha / Lib / Des / DESTEST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-18  |  1.1 KB  |  53 lines

  1. /*
  2.  * $Source: /mit/kerberos/src/lib/des/RCS/destest.c,v $
  3.  * $Author: jtkohl $
  4.  *
  5.  * Copyright 1988 by the Massachusetts Institute of Technology.
  6.  *
  7.  * For copying and distribution information, please see the file
  8.  * <mit-copyright.h>.
  9.  */
  10.  
  11. #ifndef    lint
  12. static char rcsid_destest_c[] =
  13. "$Header: destest.c,v 4.0 89/01/23 10:03:38 jtkohl Exp $";
  14. #endif    lint
  15.  
  16. #include <mit-copyright.h>
  17. #include <stdio.h>
  18. #include <des.h>
  19.  
  20. char clear[] = "eight bytes";
  21. char cipher[8];
  22. char key[8];
  23. Key_schedule schedule;
  24.  
  25. main()
  26. {
  27.     int i;
  28.     string_to_key("good morning!", key);
  29.     i = key_sched(key, schedule);
  30.     if (i) {
  31.     printf("bad schedule (%d)\n", i);
  32.     exit(1);
  33.     }
  34.     for (i = 0; i < 10000; i++)
  35.     ecb_encrypt(clear, cipher, i&1, schedule);
  36. }
  37.  
  38. /*
  39.  * gcc optimized, old e: 34.6
  40.  * gcc optimized, new e: 23.9
  41.  *
  42.  * gcc unopt,     old e: 73.9
  43.  * gcc unopt,     new e: 46.6
  44.  *
  45.  * pcc optimized, old e: 40.8
  46.  * pcc optimized, asm e: 26.5
  47.  * pcc optimized, new e: 31.1
  48.  *
  49.  * pcc unopt,     old e: 34.1
  50.  * pcc unopt,     asm e: 21.3
  51.  * pcc unopt,     new e: 25.8
  52.  */
  53.